<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>do-while</title>
</head>
<body>
  <button onclick="funDo()">跑二十圈</button>
    <button onclick="funAdd100()">计算1到100之间所有整数累加之和</button>
    <button onclick="funAddEven()">计算1到100之间所有偶数累加之和</button>
    <button onclick="funContinue()">循环跳过周三</button>
    <button onclick="funBreak()">跳出循环</button>
</body>
<script>

    function funBreak(){
        for(var i=1;i<=7;i++){
            if(i==3){
                break
            }
            console.log("今天星期" + i + "洗碗")
        }
    }

    function funContinue(){
        for(var i=1;i<=7;i++){
            if(i==3){
                continue
            }
            console.log("今天星期" + i + "洗碗")
        }
    }


  function funAddEven() {
        //1-100之间所有奇数之和
      var sum = 0
      for(var i = 1;i<=100;i+=2){
         sum += i
      }
      console.log(sum)
  }


  function funAdd100() {
        //1-100之间所有整数之和
      var sum = 0
      for(var i=1;i<=100;i++){
          sum += i
      }
      console.log(sum)
  }

  function funDo(){
     //聂茹风跑20圈的问题
      for(var i=1;i<=20;i++){
          console.log("聂茹风跑了第" + i + "圈")
      }

      console.log("终于跑完了")
  }
</script>
</html>